package com.easy.life.controller;

import com.easy.life.common.R;
import com.easy.life.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
public class OssController {

    @Autowired
    private OssService ossService;
    /**
     * 文件上传
     */
    @PostMapping("/file/upload")
    public R uploadFile(@RequestBody(required = false) List<MultipartFile> files){

        return  ossService.uploadPictures(files);
    }

    @PostMapping("/avatar/upload")
    public R uploadAvatar(@RequestBody(required = false) MultipartFile file){
        return ossService.uploadAvatar(file);
    }

}
